package com.ruoyi.cmelasercladding.controller;

import com.ruoyi.cmelasercladding.domain.ZsCladdingProcess;
import com.ruoyi.cmelasercladding.service.IZsCladdingProcessService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * cmelasercladdingController
 * 
 * @author zousong
 * @date 2022-03-10
 */
@RestController
@RequestMapping("/cmelasercladding/cmelasercladding")
public class ZsCladdingProcessController extends BaseController
{
    @Autowired
    private IZsCladdingProcessService zsCladdingProcessService;

    /**
     * 查询cmelasercladding列表
     */
    @PreAuthorize("@ss.hasPermi('cmelasercladding:cmelasercladding:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZsCladdingProcess zsCladdingProcess)
    {
        startPage();
        List<ZsCladdingProcess> list = zsCladdingProcessService.selectZsCladdingProcessList(zsCladdingProcess);
        return getDataTable(list);
    }

    /**
     * 导出cmelasercladding列表
     */
    @PreAuthorize("@ss.hasPermi('cmelasercladding:cmelasercladding:export')")
    @Log(title = "cmelasercladding", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZsCladdingProcess zsCladdingProcess)
    {
        List<ZsCladdingProcess> list = zsCladdingProcessService.selectZsCladdingProcessList(zsCladdingProcess);
        ExcelUtil<ZsCladdingProcess> util = new ExcelUtil<ZsCladdingProcess>(ZsCladdingProcess.class);
        util.exportExcel(response, list, "cmelasercladding数据");
    }

    /**
     * 获取cmelasercladding详细信息
     */
    @PreAuthorize("@ss.hasPermi('cmelasercladding:cmelasercladding:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zsCladdingProcessService.selectZsCladdingProcessById(id));
    }

    /**
     * 新增cmelasercladding
     */
    @PreAuthorize("@ss.hasPermi('cmelasercladding:cmelasercladding:add')")
    @Log(title = "cmelasercladding", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZsCladdingProcess zsCladdingProcess)
    {
        return toAjax(zsCladdingProcessService.insertZsCladdingProcess(zsCladdingProcess));
    }

    /**
     * 修改cmelasercladding
     */
    @PreAuthorize("@ss.hasPermi('cmelasercladding:cmelasercladding:edit')")
    @Log(title = "cmelasercladding", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZsCladdingProcess zsCladdingProcess)
    {
        return toAjax(zsCladdingProcessService.updateZsCladdingProcess(zsCladdingProcess));
    }

    /**
     * 删除cmelasercladding
     */
    @PreAuthorize("@ss.hasPermi('cmelasercladding:cmelasercladding:remove')")
    @Log(title = "cmelasercladding", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zsCladdingProcessService.deleteZsCladdingProcessByIds(ids));
    }
}
